package org.jeecg.modules.manager.service.impl;

import org.jeecg.modules.manager.entity.DeletedEnum;
import org.jeecg.modules.manager.entity.SpareParts;
import org.jeecg.modules.manager.mapper.SparePartsMapper;
import org.jeecg.modules.manager.service.ISparePartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;

/**
 * @Description: 零配件表
 * @Author: jeecg-boot
 * @Date:   2021-11-19
 * @Version: V1.0
 */
@Service
public class SparePartsServiceImpl extends ServiceImpl<SparePartsMapper, SpareParts> implements ISparePartsService {

    @Autowired
    SparePartsMapper sparePartsMapper;

    @Override
    public int removeIds(String ids) {
        try {
            Arrays.stream(ids.split(",")).forEach(s -> sparePartsMapper.updateById(new SpareParts().setSparePartsId(s).setDeleted(DeletedEnum.TRUE)));
            return 0;
        }catch (Exception e){
            return -1;
        }
    }
}
